/*
 * @Author: xudc
 * @Date: 2021-03-24 19:53:00
 * @LastEditTime: 2021-03-25 17:16:15
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /000/lagouXudc/lagou-xudc-task/part1/fed-e-task-01-01/code/code1.js
 */
/*
  将下面异步代码使用 Promise 的方法改进
  尽量用看上去像同步代码的方式
  setTimeout(function () {
    var a = 'hello'
    setTimeout(function () {
      var b = 'lagou'
      setTimeout(function () {
        var c = 'I ♥ U'
        console.log(a + b +c)
      }, 10)
    }, 10)
  }, 10)
*/

Promise.resolve().then(() => {
  setTimeout(() => {
    return 'hello';
  }, 10);
}).then(v => {
  setTimeout(() => {
    return v + 'lagou';
  }, 20);
}).then(v => {
  setTimeout(() => {
    console.log(v + 'I ♥ U');
  }, 30);
});
